package util;

import org.apache.log4j.spi.Filter;
import org.apache.log4j.spi.LoggingEvent;

public class ThreadFilter extends Filter {
    public String threadName;

    public ThreadFilter() {
    }

    public String getThreadName() {
        return threadName;
    }

    public void setThreadName(String threadName) {
        this.threadName = threadName;
    }

    public int decide(LoggingEvent event) {
        if (threadName == null)
            return Filter.NEUTRAL;
        if (threadName.equals(event.getThreadName()))
            return Filter.ACCEPT;
        else
            return Filter.DENY;
    }
}
